package com.nineclock.document.service.Impl;

import com.nineclock.common.threadlocal.CurrentUserHolder;
import com.nineclock.document.dto.DocFolderDto;
import com.nineclock.document.mapper.DocFolderMapper;
import com.nineclock.document.pojo.DocFolder;
import com.nineclock.document.service.DocFolderService;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.Date;


@Service
@Slf4j
public class DocFolderServiceImpl implements DocFolderService {

    //注入对象
    @Autowired
    DocFolderMapper docFolderMapper;

    @Override
    public void createFolder(DocFolderDto docFolderDto) {


        DocFolder docFolder=new DocFolder();
        docFolder.setParentId(docFolderDto.getParentId());
        docFolder.setStatus((short)1);
        docFolder.setCreateUserId(CurrentUserHolder.get().getCompanyUserId());
        docFolder.setCreateTime(new Date());
        docFolder.setCompanyId(CurrentUserHolder.get().getCompanyId());
        docFolder.setName(docFolderDto.getName());

        docFolderMapper.insert(docFolder);




    }
}
